package com.googlecode.todo_robot;

import com.google.appengine.tools.development.ApiProxyLocalImpl;
import com.google.apphosting.api.ApiProxy;
import org.junit.After;
import org.junit.Before;

import java.io.File;

/**
 * @author Fuad Ibrahimov
 * @since 08.01.2010
 */
public abstract class BaseTestCase {
  @Before
  public final void setUp() throws Exception {
    ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment());
    ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")) {});
  }

  @After
  public final void tearDown() throws Exception {
    // not strictly necessary to null these out but there's no harm either
    ApiProxy.setDelegate(null);
    ApiProxy.setEnvironmentForCurrentThread(null);
  }
}
